package com.rapid.maintenance.ui.activity.machining;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.drawerlayout.widget.DrawerLayout;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.rapid.maintenance.R;
import com.rapid.maintenance.adapter.SimpleSliderAdapter;
import com.rapid.maintenance.base.BaseActivity;
import com.youth.banner.Banner;
import com.youth.banner.Transformer;
import com.youth.banner.loader.ImageLoader;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

public class MachiningClassifyActivity extends BaseActivity {
    @BindView(R.id.tv_classify)
    TextView tvClassify;
    @BindView(R.id.tv_search)
    TextView tvSearch;
    @BindView(R.id.ll_search_bar)
    LinearLayout llSearchBar;
    @BindView(R.id.baojiadingdan)
    TextView baojiadingdan;
    @BindView(R.id.guanzhushangjia)
    TextView guanzhushangjia;
    @BindView(R.id.tuijianyouli)
    TextView tuijianyouli;
    @BindView(R.id.dindanshoucang)
    TextView dindanshoucang;
    @BindView(R.id.jiagongbaike)
    TextView jiagongbaike;
    @BindView(R.id.jiagongjindu)
    TextView jiagongjindu;
    @BindView(R.id.feibiaodingzhi)
    TextView feibiaodingzhi;
    @BindView(R.id.xinshouzhinan)
    TextView xinshouzhinan;
    @BindView(R.id.rl_fabuxunjiadan)
    RelativeLayout rlFabuxunjiadan;
    @BindView(R.id.rl_pingzhixunjiadan)
    RelativeLayout rlPingzhixunjiadan;
    @BindView(R.id.rl_xufangshangjia)
    RelativeLayout rlXufangshangjia;
    @BindView(R.id.rl_pingzhigongfanshangjia)
    RelativeLayout rlPingzhigongfanshangjia;
    @BindView(R.id.slider)
    RecyclerView slider;
    @BindView(R.id.drawer)
    DrawerLayout drawer;
    @BindView(R.id.banner)
    Banner banner;
    private SimpleSliderAdapter sliderAdapter;

    @Override
    protected int provideRootLayout() {
        return R.layout.activity_machining_classify;
    }

    @Override
    protected void init() {
        setTitle("机加工分类");
        setStatusBarColor(0xFF016DB6);
        setToolBarColor(0xFF016DB6);


        slider.setAdapter(sliderAdapter = new SimpleSliderAdapter());
        sliderAdapter.setOnSelectCallBack(s -> startActivity(new Intent(this, DeviceShareListActivity.class).putExtra("data", s)));
        sliderAdapter.addData("数控机床");
        sliderAdapter.addData("传动系统");
        sliderAdapter.addData("机床主体");
        sliderAdapter.addData("进口设备");
        sliderAdapter.addData("装配组件");
        sliderAdapter.addData("设备改造");
        sliderAdapter.addData("注 塑 机");

        List<Integer> images = new ArrayList<>();
        images.add(R.drawable.machining_banner);
        images.add(R.drawable.machining_banner);
        images.add(R.drawable.machining_banner);
        images.add(R.drawable.machining_banner);
        images.add(R.drawable.machining_banner);
        images.add(R.drawable.machining_banner);
        banner.setImageLoader(new ImageLoader() {
            @Override
            public void displayImage(Context context, Object path, ImageView imageView) {
                Glide.with(imageView).load(path).into(imageView);
            }
        }).setBannerAnimation(Transformer.DepthPage).setImages(images).start();
    }


    @OnClick({R.id.tv_classify, R.id.tv_search, R.id.baojiadingdan, R.id.guanzhushangjia, R.id.tuijianyouli, R.id.dindanshoucang, R.id.jiagongbaike, R.id.jiagongjindu, R.id.feibiaodingzhi, R.id.xinshouzhinan, R.id.rl_fabuxunjiadan, R.id.rl_pingzhixunjiadan, R.id.rl_xufangshangjia, R.id.rl_pingzhigongfanshangjia})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_classify:
                break;
            case R.id.tv_search:
                break;
            case R.id.baojiadingdan://报价订单
                break;
            case R.id.guanzhushangjia:
                break;
            case R.id.tuijianyouli:
                break;
            case R.id.dindanshoucang:
                break;
            case R.id.jiagongbaike://加工百科
                startActivity(MachiningWikiListActivity.class);
                break;
            case R.id.jiagongjindu:
                break;
            case R.id.feibiaodingzhi:
                break;
            case R.id.xinshouzhinan:
                break;
            case R.id.rl_fabuxunjiadan://发布询价单
                startActivity(MachiningPublishOrderActivity.class);
                break;
            case R.id.rl_pingzhixunjiadan:
                break;
            case R.id.rl_xufangshangjia:
                break;
            case R.id.rl_pingzhigongfanshangjia:
                break;
        }
    }

}
